<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <link rel="stylesheet" href="css/mian.css"/>
</head>
<body>
<div id="container">
    <div id="top">
        <h1>博客管理系统</h1>
        <div id="top_id">欢迎您：<?php echo $_SESSION['admin_name'] ?>
            <a href="index.php?c=logout">退出登录</a>
        </div>
    </div>
    <div id="left">
        <ul>
            <li><a href="index.php?c=category_list">分类管理</a></li>
            <li><a href="index.php?c=article_list">新闻管理</a></li>
            <li><a href="index.php?c=admin_list">管理员</a></li>
        </ul>
    </div>
    <div id="right">
        <div id="right_tao">
            <a href="index.php?c=article_list">首页</a>
            <a href="index.php?c=article_list">文章管理</a>
            <a href="index.php?c=article_list">文章列表</a>
        </div>
        <div id="table">
            <!--            <button class="but">全选</button>-->
            <!--            <a href="#">删除选中的任务</a>-->
            <a href="index.php?c=article_add" id="p">增加文章</a>
        </div>
        <div id="table_list">
            <table border="" cellspacing="" cellpadding="">
                <tr>
                    <th></th>
                    <th>Id</th>
                    <th>标题</th>
                    <th>分类名称</th>
                    <th>简介</th>
                    <th>发表时间</th>
                    <th>修改时间</th>
                    <th>操作</th>
                </tr>
                <?php foreach ($articleList as $value): ?>
                    <tr>
                        <td><input type="checkbox"/></td>
                        <td><?php echo $value['article_id']; ?></td>
                        <td><?php echo $value['article_title']; ?></td>
                        <td>
                            <?php
                            //echo $row['category_id'];
                            $sql = "select * from category where category_id='{$value['category_id']}'";
                            $result = $db->query($sql);
                            $category = $result->fetch(PDO::FETCH_ASSOC);
                            echo $category['category_name'];
                            ?>
                        </td>
                        <td><?php echo $value['intro']; ?></td>
                        <td><?php echo date("Y-m-d H:i-s" ,$value['add_time']); ?></td>
                        <td><?php echo date("Y-m-d H:i-s" ,$value['update_time']); ?></td>
                        <td>
                            <a href="index.php?c=article_edit&article_id=<?php echo $value['article_id']; ?>">编辑</a>
                            <a href="index.php?c=article_delete&article_id=<?php echo $value['article_id']; ?>">删除</a>
                        </td>
                    </tr>
                <?php endforeach; ?>
            </table>
        </div>
    </div>
</div>
</body>
</html>